//
//  LoadingMask.swift
//  ANOASTORE
//
//  Created by hudan on 2025/5/27.
//  Copyright © 2025 zwb. All rights reserved.
//

// 加载中的扇形蒙版

import UIKit

//class LoadingMask {
//    private init() {}
//    static let shared = LoadingMask()
//    
//    private(set) var loadCoverImage: UIImage = loadCoverImg()
//    
//}
//
//func loadCoverImg(color: UIColor = .init(white: 0, alpha: 0.4)) -> UIImage {
//    let coverView = UIView()
//    coverView.backgroundColor = .clear
//    coverView.frame = .init(x: 0, y: 0, width: 100, height: 100)
//
//    
//    let iconView = UIView()
//    iconView.backgroundColor = .init(white: 0, alpha: 0.4)
//    iconView.frame = coverView.bounds
//    
//    
//    let width = iconView.frame.size.width/2
//    let maskPath = UIBezierPath.init(rect: iconView.bounds)
//    let maskCyclePath = UIBezierPath.init(arcCenter: .init(x: width, y: width), radius: width - 10, startAngle: 0, endAngle: 2*CGFloat.pi, clockwise: false)
//    maskPath.append(maskCyclePath)
//    
//    let mask = CAShapeLayer()
//    mask.path = maskPath.cgPath
//    
//    iconView.layer.mask = mask
//    
//    coverView.addSubview(iconView)
//    
//    
//    let cycleWidth = width - 14
//    let center = CGPoint(x: cycleWidth, y: cycleWidth)
//    let radius: CGFloat = cycleWidth
//    let startAngle = -CGFloat.pi/2
//    let endAngle = CGFloat.pi/5
//    
//    let cyclePath = UIBezierPath()
//    cyclePath.move(to: center)
//    cyclePath.addArc(withCenter: center, radius: radius, startAngle: startAngle, endAngle: endAngle, clockwise: false)
//    cyclePath.close()
//    cyclePath.fill()
//    
//    let layer = CAShapeLayer()
//    layer.fillColor = UIColor.init(white: 0, alpha: 0.4).cgColor
//    layer.strokeColor = UIColor.init(white: 0, alpha: 0.4).cgColor
//    layer.path = cyclePath.cgPath
//    
//    let cycleView = UIView()
//    cycleView.backgroundColor = .clear
//    cycleView.frame = CGRectMake(width - cycleWidth, width - cycleWidth, cycleWidth*2, cycleWidth*2)
//    cycleView.layer.addSublayer(layer)
//    
//    coverView.addSubview(cycleView)
//    
//    
//    let render = UIGraphicsImageRenderer(size: coverView.bounds.size)
//    return render.image { _ in
//        coverView.drawHierarchy(in: coverView.bounds, afterScreenUpdates: true)
//    }
//}

